<?php
require_once dirname(__FILE__) . '/home_functions.php';
$op = get_get("op");
$node = get_get("node");

if (isAjaxRequest()) {
    if ($node == "home") {
        require_once dirname(__FILE__) . '/models/home.php';
    }
    if ($node == "settings") {
        require_once dirname(__FILE__) . '/models/settings.php';
    }
    if ($node == "message") {
        require_once dirname(__FILE__) . "/models/message.php";
    }
}
global $name, $mail, $uid;
global $class, $grade, $gender, $introduction;
global $temp;
global $_G;
global $message;
global $messagetype;
global $isOwner;
$opuid = get_get("uid");
if ($opuid == "" || $opuid == $_G["logininfo"]["uid"]) {
    $name = $_G["profile"]["name"];
    $mail = $_G["logininfo"]["mail"];
    $uid = $_G["logininfo"]["uid"];
    $gender = $_G["profile"]["gender"];
    $class = $_G["profile"]["class"];
    $grade = $_G["profile"]["grade"];
    $introduction = $_G["profile"]["introduction"];
    $isOwner = true;
} else {
    $profile = getProfile($opuid);
    $logininfo = getLoginInfo($opuid);
    if (empty($profile) || empty($logininfo)) {
        $message = "你所访问的空间不存在";
        $messagetype = "error";
        $temp = "modules/module_info.php";
        return;
    }
    $name = $profile["name"];
    $mail = $logininfo["mail"];
    $uid = $logininfo["uid"];
    $gender = $profile["gender"];
    $class = $profile["class"];
    $grade = $profile["grade"];
    $introduction = $profile["introduction"];
    $isOwner = false;
}

if ($op = "requesttemple") {
    if ($node == "home") {
        loadTemp("modules/home/home_temp.php");
        die();
    }
    if ($node == "settings") {
        loadTemp("modules/home/settings_temp.php");
        die();
    }
    if ($node == "message") {
        loadTemp("modules/home/message_temp.php");
        die();
    }
}


$temp = "modules/home/header_temp.php";
?>